package com.dys.hejiayuncommunity.common.core.page;

import java.io.Serializable;
import java.util.List;

/**
 * @className: com.dys.hejiayuncommunity.common.core.page.PageResult
 * @description: 分页查询统一响应封装类
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/12/03 23:04
 */
public class PageResult implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 总记录数
     */
    private long total;

    /**
     * 列表记录数
     */
    private List<?> rows;

    /**
     * 消息状态码
     */
    private Integer code;

    /**
     * 消息内容
     */
    private String message;

    public PageResult() {
    }

    /**
     * 分页查询
     *
     * @param total 总记录数
     * @param rows  列表记录数
     */
    public PageResult(long total, List<?> rows) {
        this.total = total;
        this.rows = rows;
    }

    public PageResult(long total, List<?> rows, Integer code, String message) {
        this.total = total;
        this.rows = rows;
        this.code = code;
        this.message = message;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<?> getRows() {
        return rows;
    }

    public void setRows(List<?> rows) {
        this.rows = rows;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
